<template>
  <div class="page-news-list-main">
    <ComBanner :bannerText="bannerText" />
    <div class="news-list">
      <div class="list-text">
        <img :src="newsListInfo.newsListImg" alt="" />
      </div>
      <NewsListInfo :newsList="newsList" />
      <!-- 分页 -->
      <NewsListPage />
    </div>
  </div>
</template>

<script>
import { mapState } from "vuex";
// import { NewsListApi } from "@/api/api";
import NewsListInfo from "./components/newsList/NewsListInfo.vue";
import NewsListPage from "./components/newsList/NewsListPage.vue";
export default {
  name: "NewsList",
  components: { NewsListInfo, NewsListPage },
  data() {
    return {
      // bannerText: {},
      // newsListInfo: {},
      // newsList: [],
    };
  },
  mounted() {
    // this.getNewsList();
    this.$store.dispatch("newsList/AnewsListApi");
  },
  computed: {
    ...mapState({
      bannerText: (state) => state.newsList.bannerText,
      newsListInfo: (state) => state.newsList.newsListInfo,
      newsList: (state) => state.newsList.newsList,
    }),
  },
  methods: {
    // getNewsList() {
    //   NewsListApi.newsList().then((res) => {
    //     const { newsListInfo, newsList, bannerText } = res.data;
    //     this.newsListInfo = newsListInfo;
    //     this.newsList = newsList;
    //     this.bannerText = bannerText;
    //     // console.log(456, this.newsListInfo, this.newsList);
    //   });
    // },
  },
};
</script>

<style scoped lang="less">
.page-news-list-main {
  .list-text {
    margin-top: 50px;
    margin-bottom: 50px;
  }
}
</style>